home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / prog / vbengine.zip / MAKEDB.FRM (.txt) < prev    next >
Visual Basic Form  |  1993-04-04  |  4KB  |  86 lines

  1. Form1
  2. (Customer Database Table Creation Example
  3. Form1
  4. Label1
  5. This example program shows how to create a Paradox database table using the VBENGINE. Examine the source code to see how its done.
  6. Command1
  7. Create Table
  8. Command2
  9. Create Index
  10. Form_Click
  11. Command1_Click
  12. Customer
  13. NewTable
  14.     TableNameh
  15. NFields
  16. FieldNames^
  17. FieldTypes
  18. status
  19. OpenEngine
  20. CreateTable
  21. CloseEngine0
  22. Command2_Click
  23.     customers
  24. exact
  25. AddKey
  26. PRIMARY
  27. Command1_Click
  28. We will declare a variable of type NewTable to create ourr
  29. database table
  30. Used to detect errors.
  31. Our database will consist of 6 fields and have
  32. the following structure:
  33.    Field
  34.  Type 
  35.    Name
  36.  A50 
  37.    Address
  38.      A50
  39.    City
  40.  A30 
  41.    State
  42.    Zip
  43.    Phone
  44. Lets fill in the details of the tables structure heree
  45. C:\Customer"
  46. Specify the database file name
  47. Six fields:Name,Address,City,State,Zip, and Phoned
  48. Name,Address,City,State,Zip,Phone"
  49. A50,A50,A30,A2,A10,A14
  50. Ok, lets go ahead and create the database table usingg
  51. VBENGINE function callss
  52. Customer Creation Example"
  53. Initialize database engine
  54. If an error terminate the programr
  55. Database Engine environment could not be initialized!"
  56. Create the database tablee
  57. If an error terminate the program 
  58. Customer database could not be created!"
  59. Customer database was successfully created!"
  60. Tell the user everything is A OK!
  61. Now shut-down the database engine environmentd
  62. If an error terminate the programi
  63. Database engine could not be shut-down!"
  64. Command2_Click
  65. Here we create a PRIMARY index for the Customer tablee
  66. on the Name field. This will be our only key field
  67. in the Primary index..
  68. no two customers will be able to have the exact same namee
  69. and the table will be sorted alphabeticallyy
  70. for error handling
  71. Customer Creation Example"
  72. Initialize database engine
  73. If an error terminate the programt
  74. Database Engine environment could not be initialized!"
  75. We will use the AddKey function to create the indexx
  76. The table name is "C:\CUSTOMER"
  77. We want only one key field..
  78. It is Name, the first field in the table..
  79. C:\CUSTOMER"
  80. If index creation failed
  81. Failed to create Customer index!
  82. Customer index successfully created!
  83. Now shut-down the database engine environment"
  84. If an error terminate the programi
  85. Database engine could not be shut-down!"
  86.